#ifndef RANDOM_CASCADE_CLASSIFIER_H__CMU_
#define RANDOM_CASCADE_CLASSIFIER_H__CMU_

#include "svm.h"

#include <vector>
using namespace std;

class Layer;

class RandomCascadeClassifier {
	vector<Layer *> layers;
	double gamma;
public :
	void train(svm_problem & prob, int dim, int layer_num, double g);
	double test(svm_node * x);
	void dump(char * filename);
	void load(char * filename);
	~RandomCascadeClassifier();
private:
	double test(svm_node * x, Layer * layer);
	void get_positive_samples(svm_problem & prob, vector<svm_node *> & positive);
	svm_node * get_direction(int dim, int & l);
	double get_threshold(vector<svm_node *> & positive_samples, const svm_node *w);
	double chi_square_kernel(const svm_node *x, const svm_node *w);
};

#endif